<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/22 0022
 * Time: 10:11
 */

namespace app\user\controller;

use cmf\controller\UserBaseController;
use app\user\model\DistributeModel;

class DistributeController extends UserBaseController
{
 public function index(){
     $distribute = new DistributeModel();
     $data              = $distribute->level_one();
     $user              = cmf_get_current_user();
     $this->assign($user);
     /* 一级 */
     $this->assign("page", $data['page']);
     $this->assign("lists", $data['lists']);
     /* 二级 */
     $this->assign("page2", $data['page2']);
     $this->assign("lists2", $data['lists2']);
     /* 三级 */
     $this->assign("page3", $data['page3']);
     $this->assign("lists3", $data['lists3']);
     return $this->fetch('index');
 }

    /**
     *   @Notes:查询下一级的成员
     *   @Function next
     *   @author: xy
     *   @Time: 2018/11/22 0022   13:49
     * xxx
     */
 public function next(){
     $distribute = new DistributeModel();
     $id = $this->request->param("id");
     $data              = $distribute->next_distribute($id);
     $user              = cmf_get_current_user();
     $this->assign($user);
     /* 一级 */
     $this->assign("page", $data['page']);
     $this->assign("lists", $data['lists']);
     /* 二级 */
     $this->assign("page2", $data['page2']);
     $this->assign("lists2", $data['lists2']);
     /* 三级 */
     $this->assign("page3", $data['page3']);
     $this->assign("lists3", $data['lists3']);
     return $this->fetch('index');
 }

    /**
     *   @Notes:取消层级关系
     *   @Function delete
     *   @author: xy
     *   @Time: 2018/11/22 0022   13:51
     *
     */
 public function negate(){
     $data = $this->request->param();
     $distribute = new DistributeModel();
     $ret = $distribute->negate_distinct($data['id'],$data['negate_obj']);//$data['negate_obj']:1父级；2祖级；3太级；
     if ($ret) {
         $this->success("取消关系成功！你再也获取不到他的分成了！");
     } else {
         $this->error("取消失败了！");
     }

 }
}